home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11660 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  30 lines

  1. Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++
  2. Path: in2.uu.net!world!bobduff
  3. From: bobduff@world.std.com (Robert A Duff)
  4. Subject: Re: C/C++ knocks the crap out of Ada
  5. Message-ID: <DoBIoL.1JC@world.std.com>
  6. Organization: The World Public Access UNIX, Brookline, MA
  7. References: <JSA.96Feb16135027@organon.com> <4hf701INNdl7@keats.ugrad.cs.ubc.ca> <4hm6lo$eln@fred.netinfo.com.au> <4hml8s$a1q@solutions.solon.com>
  8. Date: Fri, 15 Mar 1996 16:48:20 GMT
  9.  
  10. In article <4hml8s$a1q@solutions.solon.com>,
  11. Peter Seebach <seebs@solutions.solon.com> wrote:
  12. >Certainly.  A C implementation is free to be an interpreter that emulates
  13. >every bit of every value and checks for arbitrary programming errors.
  14. >
  15. >There is no restriction that an implementation may not offer range checking,
  16. >and many already do have stricter type checking than the standard requires.
  17.  
  18. But C doesn't have any syntax for defining the range of an int, except:
  19.  
  20.     int x; /* x is always between 1 and 10 */
  21.  
  22. So how can a C implementation check this range, without extending the
  23. syntax of the language?  There are many other examples.
  24.  
  25. It is true that a C implementation can check array bounds without
  26. extending the language.  But it's quite expensive at run time, because
  27. of the confusion between pointers and arrays.
  28.  
  29. - Bob
  30.